<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var pivotArray = function(nums, pivot) {
    let arr1 = [], arr2 = [], arr3 = []
    for(let i = 0; i < nums.length; i++) {
        let arr = nums[i] === pivot ? arr2 : nums[i] < pivot ? arr1 : arr3
        arr.push(nums[i])
    }
    return[...arr1, ...arr2, ...arr3]
};
console.log(pivotArray([9,12,5,10,14,3,10],10));
  </script>
</body>
</html>